<?php
	require "settings/config.php";
	require "layout.php";
	require "includes/sql_functions.php";
	require "includes/scen_functions.php";
	require "includes/session.php";
	
	oh_require_admin();
	
	if($_POST['code']!="" && $_POST['system']!="" && $_POST['title']!="" && $_POST['minlevel']>0 && $_POST['maxlevel']>0)
	{
		$result=(oh_scen_add($_POST['code'],$_POST['system'],$_POST['title'],$_POST['subtitle'],$_POST['minlevel'],$_POST['maxlevel'],$_POST['desc']));
		
		if($result=="duplicate")
			header('Location: scenarios.php?duplicate=1');
			
		if($result=="success")
			header('Location: scenarios.php?success=1');
	}
	else
	{
		header('Location: scenarios.php?missing=1');
	}

?>
